/* Author : Maisa Nurul Agnia */
package jtk.project4.fleet.screen.AddEditPartToPurcahseOrder;

import java.awt.FlowLayout;

import jtk.project4.fleet.field.AddEditPartToPurchaseOrderField;

import nl.coderight.jazz.form.FormHeader;
import nl.coderight.jazz.form.FormView;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.button.PushButton;

public class AddEditPartToPurchaseOrderView extends FormView{

	private FormHeader formHeader;
	private PushButton submitButton;
	private PushButton cancelButton;
	@Override
	protected void init() {
		// TODO Auto-generated method stub
		createFields();
		createLayout();
		
	}
	
	private void createFields()
	{
		submitButton = new PushButton("saveAction");
		cancelButton = new PushButton("cancelAction");
	}
	
	private void createLayout()
	{
		setHeader(createHeader());
		addField(createForm());
		
	}
	
	private FormHeader createHeader()
	{
		formHeader = new FormHeader();
		formHeader.setTitle("AddPartToPurchaseOrder.header.form");
		return formHeader;
	}
	
	private GroupControl createForm()
	{
		GroupControl form = new GroupControl();
		form.addField(new AddEditPartToPurchaseOrderField("PurchaseOrder"),NORTH);
		form.addField(createButtons(),SOUTH);
		return form;
	}
	
	private GroupControl createButtons()
	{
		GroupControl buttons = new GroupControl();
		buttons.setLayout(new FlowLayout(FlowLayout.RIGHT));
		buttons.addField(submitButton);
		buttons.addField(cancelButton);
		return buttons;
		
	}
	

}
